# Contributor: Umar Getagazov <umar@handlerug.me>
# Maintainer: Umar Getagazov <umar@handlerug.me>
pkgname=mycorrhiza
pkgver=1.14.0
pkgrel=9
pkgdesc="Lightweight wiki engine based on Git"
url="https://mycorrhiza.wiki/"
arch="all"
license="AGPL-3.0-only"
depends="git"
makedepends="go"
install="$pkgname.pre-install"
subpackages="$pkgname-doc $pkgname-openrc"
options="!check net"  # no test suite, needs to download go modules
source="$pkgname-$pkgver.tar.gz::https://github.com/bouncepaw/mycorrhiza/archive/refs/tags/v$pkgver.tar.gz
	enable-cgo.patch
	mycorrhiza.initd
	mycorrhiza.confd
	"

export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"

build() {
	make TAGGED_RELEASE="$pkgver"
}

package() {
	make PREFIX="$pkgdir"/usr install
	install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
	install -Dm644 "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname
}

sha512sums="
fe40f5d382255e5439ace7218c28c1df62e368325835e48d563a52c3432e1f0a967924e4cd569d860f3094f942b94d4a6807d8fbf76db6c6b758a8c74a92b77c  mycorrhiza-1.14.0.tar.gz
88fb974fa9f6417326e4bfa4ad4cd3e958a5c0972af4f1cffaa4ba8cb53fce6cf85d918fc351a412cbf9173d034645c5519bb33907fb0c373417ac370f61025c  enable-cgo.patch
f23ea7d6365ab456c82caefa677dd42a06e721ede65bc9197ed04bb7886233effcf64410c4757ff8b5bf5cac9f63f502df41a5539017e0a677c851c660ce8e28  mycorrhiza.initd
a8cce20285b037371dae0ceae316d0dd21a22eb42150fbe08cd58ed83772b51896b5f9bc691f3c3ffb9155375d5d87832d66330a1167fd9d926d3658ccbe1e9f  mycorrhiza.confd
"
